<?php


namespace App\Http\Controllers\DriverApp;


use App\Http\Controllers\Controller;
use App\Http\Requests\LoginRequest;
use App\Http\Requests\UsersRequests;
use App\Services\UsersService;


class   LoginController extends Controller
{
    /**
     * @param UsersRequests $request
     * @param UsersService $service
     * 司机端App登录w
     * @return LoginController|\Illuminate\Http\JsonResponse
     */
    public function login(UsersRequests $request, UsersService $service)
    {
        $phone = (string)$request->post('phone');
        $password = (string)$request->post('password');
        $type = (string)$request->post('type','2'); //登录类型
        $code = (string)$request->post('code'); //验证码
        $res = $service->user_login($phone, $password,$type,$code);
        return $this->sendJson($res);
    }

    /**
     * @param UsersRequests $request
     * @param UsersService $service
     * 司机端App注册
     */
    public function regerster(UsersRequests $request, UsersService $service)
    {
        $phone = (string)$request->post('phone');
        $password = (string)$request->post('password');
        $type = (string)$request->post('types'); //登录类型
        $res = $service->user_login($phone, $password,$type);
    }
}